<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<!-- 审批记录 -->
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
            <form id="operlog-form">
                <div class="select-list gd">
                    <ul>
                        <li>
                            进程实例Id：<input type="text" name="procInstId"/>
                        </li>
                        <li>
                            任务Id：<input type="text" name="id"/>
                        </li>
                        <li>
                            任务名称：<input type="text" name="name"/>
                        </li>
                        <li>
                            审批人ID：<input type="text" name="assignee"/>
                        </li>
                        <li>
                            描述：<input type="text" name="description"/>
                        </li>
                        <li class="select-time">
                            <label>创建时间： </label>
                            <input type="text" class="time-input" style="width: 150px" id="beginTime" placeholder="开始时间" name="beginTime" lay-key="1">
                            <span>-</span>
                            <input type="text" class="time-input" style="width: 150px" id="overTime" placeholder="结束时间" name="overTime" lay-key="2">
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm"
                               onclick="$.table.search($('form').attr('id'))"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm"
                               onclick="$.form.reset($('form').attr('id'))"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group hidden-xs" id="toolbar" role="group">
            <!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="file:add">-->
                <!--<i class="fa fa-plus"></i> 新增-->
            <!--</a>-->
            <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()"
               shiro:hasPermission="hitask:del">
                <i class="fa fa-trash-o"></i> 删除
            </a>
        </div>
        <div class="col-sm-12 select-info order-table">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>

<script th:inline="javascript">
    var prefix = "/hiTask"
    $(function () {
        var options = {
            url: prefix + "/TableMyHiTasklList",
            pictureUrl:"/task/flowChart/{id}", //流程图
            updateUrl: prefix + "/edit/{id}",
            removeUrl:prefix+"/del",
            sortName: "START_TIME_",  //对应数据库表述中的字段
            sortOrder:"desc",
            modalName: "审批",
            search: false,
            showExport: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'procInstId',
                    title: '编号</br>(Number)',//实例Id
                    align: 'center',
                },

//                {
//                    field: 'id',
//                    title: '任务ID'
//                },
//                {
//                    field: 'formKey',
//                    title: '表单ID'
//                },
                {
                    field: 'name',
                    title: '任务名称</br>(Mission Name)',//任务名称
                    align: 'center'
                },
                {
                    field: 'description',
                    title: '描述</br>(Description)',//描述
                    align: 'center'
                },
                {
                    field: 'assignee',
                    title: '审批人</br>(Approver)',//审批人
                    align: 'center'
                },
                {
                    field: 'startTime',
                    align: 'center',
                    title: '开始时间</br>(StartTime)',//创建时间
                    formatter: function (value, row, index) {
                        return $.common.dateFormat(value)
                    }
                },
                {
                    field: 'endTime',
                    title: '结束时间</br>(EndTime)',//结束时间
                    align: 'center',
                    formatter: function (value, row, index) {

                        if (value == null) {
                            return '<span class="badge badge-warning">待审批！</span>';
                        } else {
                            return $.common.dateFormat(value)
                        }

                    }
                },
                {
                    title: '操作</br>(Operate)',//操作
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = []; //onclick="fileDown(\''+row.fileId+'\',\''+row.fileName+'\')"
                        actions.push('<a class="btn btn-info btn-xs " href="#" onclick="$.operate.edit(\''+row.procInstId+'\')"><i class="fa fa-edit"></i> 查看</a> ');
                        actions.push('<a class="btn btn-warning btn-xs " href="#" onclick="ViewProcess(\'' +row.procInstId+ '\')"><i class="fa fa-edit"></i> 进度</a> ');

                        //actions.push('<a class="btn btn-success btn-xs " href="#" onclick="$.operate.FlowCharPng(\'' + row.procInstId + '\')"><i class="fa fa-picture-o"></i> 流程图</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function ViewProcess(taskId) {
        $.modal.open("审批流程", "/hiActi/HiProcActiList/"+taskId);
    }

//    function edit(taskId) {
//        $.modal.open("查看审批", "/hiActi/HiProcActiList/"+taskId);
//    }

</script>
</body>
</html>